//package person.learn.listener;
//
//import com.alibaba.fastjson.JSONObject;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.jms.annotation.JmsListener;
//import org.springframework.stereotype.Component;
//import person.learn.entity.Teacher;
//import person.learn.service.TeacherService;
//
///**
// * Created by barton on 16-2-1.
// * 1.activemq 内容消费者
// * 2.若使用外部的activemq服务，请修改application.yml的spring.activemq.broker-url/username/password
// * 3.请将pom.xml的相关依赖ActiveMQReceiveListener,ActiveMQClientServiceImpl,TeacherServiceImpl,
//      ActiveMQClientService,TeacherService,ActiveMQClientServiceImplTest的注释解开
// */
//@Component
//public class ActiveMQReceiveListener {
//
//    @Autowired
//    private TeacherService teacherService;
//
//    @JmsListener(destination = "sample.queue")
//    public void receiveQueue(String msg) {
//        teacherService.send(msg);
//
//        System.out.println("receiveQueue send finished");
//    }
//
//    @JmsListener(destination = "sample.queue")
//    public void receiveQueue(JSONObject teacherObject) {
//        Teacher teacher = JSONObject.toJavaObject(teacherObject, Teacher.class);
//
//        teacher.setId("123");
//
//        teacherService.add(teacher);
//
//        System.out.println("receiveQueue add finished");
//    }
//}
